# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-other
pkgname=kmymoney
pkgver=5.1.3
pkgrel=6
# armhf blocked by extra-cmake-modules
# armhf, ppc64le, s390x, riscv64 blocked by qt5-qtwebengine
arch="all !armhf !ppc64le !s390x !riscv64"
url="https://kmymoney.org/"
pkgdesc="Personal finance manager for KDE which operates similarly to MS-Money or Quicken"
license="GPL-2.0-or-later"
makedepends="
	akonadi-dev
	alkimia-dev
	doxygen
	extra-cmake-modules
	gpgme-dev
	kactivities5-dev
	karchive5-dev
	kcmutils5-dev
	kcompletion5-dev
	kconfig5-dev
	kconfigwidgets5-dev
	kcontacts5-dev
	kcoreaddons5-dev
	kdiagram-dev
	kdoctools5-dev
	kholidays5-dev
	ki18n5-dev
	kiconthemes5-dev
	kidentitymanagement-dev
	kio5-dev
	kitemmodels5-dev
	kitemviews5-dev
	knotifications5-dev
	kservice5-dev
	ktextwidgets5-dev
	kwallet5-dev
	kxmlgui5-dev
	qt5-qtbase-dev
	qt5-qtsvg-dev
	qt5-qtwebengine-dev
	samurai
	"
checkdepends="xvfb-run"
_repo_url="https://invent.kde.org/office/kmymoney.git"
source="https://download.kde.org/stable/kmymoney/$pkgver/src/kmymoney-$pkgver.tar.xz"
subpackages="$pkgname-doc $pkgname-lang"

case $CARCH in
aarch64) options="!check" ;; # Segfault / child aborted errors on 3-12 builder
esac

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DENABLE_WEBENGINE=ON
	cmake --build build
}

check() {
	# reports-chart-test requires OpenGL
	# csvimport-csvdate-test is broken
	xvfb-run ctest --test-dir build --output-on-failure -E "(reports-chart|csvimport-csvdate)-test"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
2003f25b7df77691e5d3d0f450e0139b1e68336f59a4fc78af751c5b94ecfaf17a39ee1f58ed0c2cda642195c5277fbb63c87e857ebe9a6495dc7f88b9a38794  kmymoney-5.1.3.tar.xz
"
